<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\BaseController;
use Illuminate\Http\Request;

/**
 * @package App\Http\Controllers\Api
 * @see CollectController
 */
class CollectController extends BaseController
{

    /**
     * add
     * @uri /collect/add
     * @param Request $request
     * @return \Illuminate\Http\JsonResponse
     * @request {"target_id":"486763C1072AA8E9","target_type":"A6E40C7A5636E07A","package_id":"994E326CA7A8C8FF"}
     * @response {"success":true,"statusCode":200,"result":true,"message":"OK"}
     */
    public function add(Request $request)
    {
        $params = $request->all();

        // @todo api data from mock.
        $mock = json_decode(
            mb_convert_encoding(
                '{"success":true,"statusCode":200,"result":true,"message":"OK"}'
                , 'UTF-8', 'UTF-8,GBK,GB2312,BIG5' )
            , true
        );
        $data = $mock['result'];

        return $this->apiReturn($data);
    }

    /**
     * cancel
     * @uri /collect/cancel
     * @param Request $request
     * @return \Illuminate\Http\JsonResponse
     * @request {"target_id":"3078720EC593C622","target_type":"D97F711694D7BAF4"}
     * @response {"success":true,"statusCode":200,"result":true,"message":"OK"}
     */
    public function cancel(Request $request)
    {
        $params = $request->all();

        // @todo api data from mock.
        $mock = json_decode(
            mb_convert_encoding(
                '{"success":true,"statusCode":200,"result":true,"message":"OK"}'
                , 'UTF-8', 'UTF-8,GBK,GB2312,BIG5' )
            , true
        );
        $data = $mock['result'];

        return $this->apiReturn($data);
    }

}